const express = require('express');
const router = express.Router();
const resourceController = require('../controllers/resource');
const { resourceSaveValidator, resourceExportValidator } = require('../middleware/validator');

/**
 * @route POST /api/resource/save
 * @desc 保存资源到资源库
 * @access Public
 */
router.post('/save', resourceSaveValidator, resourceController.saveResource);

/**
 * @route GET /api/resource/list
 * @desc 获取用户资源列表
 * @access Public
 */
router.get('/list', resourceController.getResourceList);

/**
 * @route GET /api/resource/:resourceId
 * @desc 获取资源详情
 * @access Public
 */
router.get('/:resourceId', resourceController.getResourceDetail);

/**
 * @route DELETE /api/resource/:resourceId
 * @desc 删除资源
 * @access Public
 */
router.delete('/:resourceId', resourceController.deleteResource);

module.exports = router;